package fr.noe.amicaleloisirs.concours.utils;

import com.google.gwt.dom.client.Style.Cursor;
import com.google.gwt.event.dom.client.MouseOutEvent;
import com.google.gwt.event.dom.client.MouseOutHandler;
import com.google.gwt.event.dom.client.MouseOverEvent;
import com.google.gwt.event.dom.client.MouseOverHandler;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.RootPanel;

public class HandlerHelper {
	
	public static void addMouseOverHandler(final Image img) {
		img.addMouseOverHandler(new MouseOverHandler() {
			
			@Override
			public void onMouseOver(MouseOverEvent event) {
				DOM.setStyleAttribute(RootPanel.getBodyElement(), "cursor", Cursor.POINTER.getCssName());
			}
		});
	}
	
	public static void addMouseOutHandler(final Image img) {
		img.addMouseOutHandler(new MouseOutHandler() {
			
			@Override
			public void onMouseOut(MouseOutEvent event) {
				DOM.setStyleAttribute(RootPanel.getBodyElement(), "cursor", Cursor.DEFAULT.getCssName());
			}
		});
	}

}
